import request from '@/utils/request'

export async function getDepartmentsListApi(params) {
  var resp = await request({
    url: '/master/department/',
    method: 'get',
    params
  })
  return resp;
}

export async function createDepartmentsApi(data) {
  var resp = await request({
    url: '/master/department/',
    method: 'post',
    data
  })
  return resp
}

export async function updateDepartmentsApi(id, data) {
  var resp = await request({
    url: '/master/department/' + id + '/',
    method: 'put',
    data
  })
  return resp
}

export async function deleteDepartmentsApi(id) {
  var resp = await request({
    url: '/master/department/' + id + '/',
    method: 'delete'
  })
  return resp
}

export async function departmentAssignUserApi(params) {
  var resp = await request({
    url: '/master/department_assign_user/',
    method: 'get',
    params
  })
  return resp
}

export async function updatedepartmentAssignUserApi(data) {
  var resp = await request({
    url: '/master/department_assign_user/',
    method: 'post',
    data
  })
  return resp
}
export async function departmentAssignSerialNumApi(params) {
  var resp = await request({
    url: '/master/department_assign_serialnum/',
    method: 'get',
    params
  })
  return resp
}
export async function updatedepartmentAssignSerialNumApi(data) {
  var resp = await request({
    url: '/master/department_assign_serialnum/',
    method: 'post',
    data
  })
  return resp
}
// 根据当前登录用户获取该用户所属部门
export async function getDepartmentsByUserListApi(params) {
  var resp = await request({
    url: '/master/departmentbyuser/',
    method: 'get',
    params
  })
  return resp;
}
